﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OOLib
{
   /// <summary>
   /// This is the base interface of all collection interfaces.
   /// </summary>
   public class ElementAccess : ComObjectWrapper, IElementAccess
   {
      #region Constructors

      /// <summary>
      /// Constructor
      /// </summary>
      /// <remarks>
      /// After using this constructor, the ComObj must be set manually!
      /// </remarks>
      public ElementAccess() :
         base()
      { }

      /// <summary>
      /// Constructor
      /// </summary>
      /// <param name="comObject">COM object</param>
      public ElementAccess(object comObject) :
         base(comObject)
      { }

      #endregion

      #region IElementAccess
      
      /// <summary>
      /// Returns the type of the elements. void means that it is a multi-type container and you cannot determine the exact types with this interface.
      /// </summary>
      /// <returns>Returns the type of the elements. void means that it is a multi-type container and you cannot determine the exact types with this interface.</returns>
      /// <remarks>!!! Not tested !!!</remarks>
      public object GetElementType()
      {
         CheckDisposed();
         return InvokeMethod("getElementType");
      }

      /// <summary>
      /// Gets if the collection has any elements.
      /// </summary>
      /// <remarks>
      /// true if the object contain elements, otherwise false.
      /// !!! Not tested !!!
      /// </remarks>
      public bool HasElements
      {
         get 
         {
            CheckDisposed();
            return (bool)InvokeMethod("hasElements"); 
         }
      }

      #endregion
   }

   /// <summary>
   /// This is the base interface of all collection interfaces.
   /// </summary>
   public interface IElementAccess
   {
      /// <summary>
      /// Returns the type of the elements. void means that it is a multi-type container and you cannot determine the exact types with this interface.
      /// </summary>
      /// <returns>Returns the type of the elements. void means that it is a multi-type container and you cannot determine the exact types with this interface.</returns>
      object GetElementType();

      /// <summary>
      /// Gets if the collection has any elements.
      /// </summary>
      /// <remarks>
      /// true if the object contain elements, otherwise false.
      /// </remarks>
      bool HasElements { get; }
   }
}
